<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>显示管理员日志</title>
</head>
<body>
<form action="getAdminLogByActionDate.do?userId=${mapAdminLog.adminId}" method="post">
    <h2>管理员日志列表</h2>
    <hr>
    请输入需查询日志的日期(如：131106)：<input type="text" name="actionDate"/>
    <button type="submit">查询</button>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<a href="showAllAdminInfo.do">返回管理员列表页</a>
    <hr>
    <table>
        <tr>
            <td>管理员ID</td>
            <td>管理员操作信息</td>
            <td>操作时间</td>
        </tr>
        <c:forEach var="adminLog" items="${mapAdminLog.listAdminLog}">
            <tr>
                <td>${adminLog.userId}</td>
                <td>${adminLog.action}</td>
                <td><fmt:formatDate value="${adminLog.actionTime}" pattern="yyyy年MM月dd日 HH:mm:ss"/></td>
            </tr>
        </c:forEach>
    </table>
    <%-- flag为0，则分页显示通过管理员id获取的管理员日志 --%>
    <c:if test="${mapAdminLog.flag eq 0}">
        <c:if test="${mapAdminLog.pageCurId gt 1}">
            <a href="/admin/adminLog/showAdminLog.do?pageCurId=${mapAdminLog.pageCurId-1}&adminId=${mapAdminLog.adminId}">上一页</a>
        </c:if>
        <c:choose>
            <c:when test="${mapAdminLog.total eq 0}">
                共 ${mapAdminLog.total+1} 页，当前第 ${mapAdminLog.pageCurId} 页
            </c:when>
            <c:otherwise>
                共 ${mapAdminLog.total} 页，当前第 ${mapAdminLog.pageCurId} 页
            </c:otherwise>
        </c:choose>

        <c:if test="${mapAdminLog.pageCurId lt mapAdminLog.total}">
            <a href="/admin/adminLog/showAdminLog.do?pageCurId=${mapAdminLog.pageCurId+1}&adminId=${mapAdminLog.adminId}">下一页</a>
        </c:if>
    </c:if>

    <%-- flag为1，则分页显示通过管理员名字获取的管理员日志 --%>
    <c:if test="${mapAdminLog.flag eq 1}">
        <c:if test="${mapAdminLog.pageCurId gt 1}">
            <a href="/admin/adminLog/getAdminLogByActionDate.do?actionDate=${mapAdminLog.actionDate}&pageCurId=${mapAdminLog.pageCurId-1}&userId=${mapAdminLog.adminId}">上一页</a>
        </c:if>
        <c:choose>
            <c:when test="${mapAdminLog.total eq 0}">
                共 ${mapAdminLog.total+1} 页，当前第 ${mapAdminLog.pageCurId} 页
            </c:when>
            <c:otherwise>
                共 ${mapAdminLog.total} 页，当前第 ${mapAdminLog.pageCurId} 页
            </c:otherwise>
        </c:choose>
        <c:if test="${mapAdminLog.pageCurId lt mapAdminLog.total}">
            <a href="/admin/adminLog/getAdminLogByActionDate.do?actionDate=${mapAdminLog.actionDate}&pageCurId=${mapAdminLog.pageCurId+1}&userId=${mapAdminLog.adminId}">下一页</a>
        </c:if>
    </c:if>
</form>
</body>
</html>